/ Assembly List / LJCNetCommon / HTMLBuilder / Line

Namespace - LJCNetCommon


Parameters
text - The add text.
addIndent - Indicates if the element can be indented.
allowNewLine - Indicates if a new line can be added.

Returns

The potentially indented and wrapped new text value.

Syntax

C#
public String Line(String text = null, Boolean addIndent = True, Boolean allowNewLine = True)

Adds a modified text line to the builder.

Remarks

Line() is an "Append" method. It creates the text with GetText() and adds a new line after the text. The text is then added to the builder.
Line() works the same as Text() except it appends a new line.

Example

C#
// Defaults: IndentCharCount = 2, LineLimit = 80, WrapEnabled = false.
var hb = new HTMLBuilder();

hb.Text("This is an appended line.");

// The builder keeps track of the current number of indents.
hb.AddIndent();

// Example Method:
// Starts the text with a newline if the builder already has text
// and param allowNewLine = true and builder text does not end with
// a newline.
// The text begins with the current indent string if param
// addIndent = true.
// Ends the text with a newline.
// Defaults: addIndent = true, allowNewLine = true.
hb.Line();

hb.Text("This is an indented line.");
var result = hb.ToString();

// result:
// This is an appended line.
//
//   This is an indented line.

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.